import { useSessionStorageState } from "ahooks";
import { createModel } from "hox";
import { useGetRequest } from "../http";
import { getAreaData } from "../http/apis/intentional-api";

const useCommon = () => {

    const [areaData, setAreaData] = useSessionStorageState('areaData')
    const params = { url: getAreaData, successAction: (data: any) => setAreaData(data.content) }
    const fetchAreaData = useGetRequest(params).run

    return {
        areaData,
        fetchAreaData,
    }
}

export default createModel(useCommon)